﻿using System;
using System.Data.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using EbbinghausWord.Common;
using EbbinghausWord.Entities;

namespace EbbinghausWord.DAL
{
    /// <summary>
    /// 数据访问上下文
    /// </summary>
    public class SysDataContext : DataContext
    {
        public static string DBConnectionString = "Data Source=isostore:/Sys.sdf;Case Sensitive = true;Max Database Size=256;";

        public SysDataContext()
            : base(DBConnectionString)
        {
        }

        //public Table<TableDictionaryEntity> TableDictionaryEntities;
        //public Table<TableBookWordEntity> TableBookWordEntities;
        public Table<TableUserWordEntity> TableUserWordEntities;
        public Table<TableVoiceEntity> TableVoiceEntities;
        //public Table<TestTable> TableTest;


        /// <summary>
        /// 创建数据库
        /// </summary>
        public static void CreateDb()
        {
            using (var db = new SysDataContext())
            {
                if (db.DatabaseExists()) return;
                db.CreateDatabase();
            }
        }
    }
}
